<template>
<div>Dialog 示例</div>
<h1>示例1</h1>
<Button @click="toggle">toggle</Button>
<Dialog v-model:visible="visible" :onOk="confirm"></Dialog>
<h1>示例2</h1>
<Button @click="showDialog">show</Button>
</template>

<script lang="ts">
import Dialog from '../lib/Dialog.vue'
import Button from '../lib/Button.vue'
import {
  ref,
  h
} from 'vue'

export default {
  components: {
    Dialog,
    Button
  },
  setup() {
    const visible = ref(false)
    const toggle = () => {
      visible.value = !visible.value
    }
    const confirm = close => {
      console.log('一秒后关闭')
      setTimeout(() => {
        close()
      }, 1000)
    }
    return {
      visible,
      toggle,
      confirm
    }
  }
}
</script>
